package com.yuwei.visit.adapter

import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.visit.R

class VisitStatusAdapter: BaseQuickAdapter<String, BaseViewHolder>(
    R.layout.item_visit_status
) {
    private var mPosition : Int = 0
    fun setPosition(position: Int){
        mPosition = position
    }
    override fun convert(holder: BaseViewHolder, item: String) {
        val tv = holder.getView<TextView>(R.id.visit_status_title)
        tv.text = item
        if(holder.adapterPosition == mPosition){
            tv.setTextColor(Color.parseColor("#1E88E5"))
            tv.setBackgroundResource(R.drawable.item_visit_status_bg2)
        }else{
            tv.setTextColor(Color.parseColor("#4B5563"))
            tv.setBackgroundResource(R.drawable.item_visit_status_bg)
        }
    }
}